﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="add_employee.aspx.cs" Inherits="Setting_add_employee" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>添加用户</title>
    <link href="../Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    	$(function () {
    		$("#emplName").bind("click", function () {
    			$("#tipSpan").html("");
    		});

    		$("input[name='UserPwd']").keydown(function (e) {
    			if (e.which == 13)
    				MySubmit();
    		});
    	});

    	function VerifyForm() {
    		if ($("#emplName").val() == "") {
    			alert('姓名不能为空!');
    			return false;
    		}
			<%if (string.IsNullOrEmpty(curID))
	{ %>
    		if ($("#username").val() == "") {
    			alert('用户不能为空!');
    			return false;
    		}
    		if ($("#userpwd").val() == "") {
    			alert('密码不能为空!');
    			return false;
    		}
    		if ($("#userpwd").val() != $("#userpwd2").val()) {
    			alert('二次输入的密码不同!');
    			return false;
    		}
			<%} %>

    		if ($("#deptID").val() == "") {
    			alert('请选择人员所在的部门!');
    			return false;
    		}

    		return true;
    	}
    	function selectDept() {
    		window.open('dlg_dept.aspx', '', 'width=400px,height=400px,scrollbars=0,resizable=no,left=' + (screen.availWidth - 400) / 2 + ',top=' + (screen.availHeight - 400) / 2);
    	}

    	function recvSelectDept(selNodes) {
    		if (selNodes != null && typeof (selNodes) != 'undefined') {

    			$.map(selNodes, function (node) {
    				$("#deptName").val(node.data.title);
    				$("#deptID").val(node.data.key);
    			});
    		}
    	}
    	function doSave(isContinue) {
    		if (VerifyForm()) {
    			$("#hidIsContinue").val(isContinue);
    			form1.submit();
    		}
    	}
    </script>
</head>
<body>
    <form id="form1" runat="server" >
    <div class="editFormTitle">添加用户</div>

    <div class="editFormSubbar">基本信息</div>
    <div class="editFormBody">
    <table id="EmplInfo" width="580px" border="0" cellpadding="3">
		<tr>
			<td>
				<font color="red">*</font>姓名：<br />
				<input type="text" id="emplName" name="emplName" value="<% if (empl!=null) Response.Write (empl.EmplName);%>" <%if (ReadOnly) Response.Write (" readOnly");%> />
			</td>
			<td>
				性别：<br />
				<input type="radio" id="male" name="sex" value="male" <%if (empl!=null) {if (empl.Sex =="male" ||empl.Sex=="") Response.Write ("checked");}else{Response.Write ("checked");}%> />男 &nbsp;&nbsp;<input type="radio" id="female" name="sex" value="female" <%if (empl!=null) if (empl.Sex=="female") Response.Write ("checked");%> />女
			</td>
			<td>
				
			</td>
		</tr>
		
		<tr >
			<td>
				<font color="red">*</font>登录名：<br />
				<input type="text" id="username" name="username" value="<% =curUserName%>" />
			</td>
			<td id="td_pwd1"><%if (string.IsNullOrEmpty(curID))
	{ %>
				<font color="red">*</font>密码：<br />
				<input type="password" id="userpwd" name="userpwd" style="width: 150px;" value="" /><%} %>
			</td>
			<td id="td_pwd2"><%if (string.IsNullOrEmpty(curID))
	{ %>
				<font color="red">*</font>重复密码：<br />
				<input type="password" id="userpwd2" name="userpwd2" style="width: 150px;" value="" /><%} %>
			</td>
		</tr>
		
		<tr>
            <td>出生日期：<br />
				<input type="text" id="birth" name="birth" value="<% Response.Write (empl.Birthday.ToString("yyyy-MM-dd"));%>" />
                </td>
            <td>固定电话：<br />
				<input type="text" id="tele1" name="tele1" value="<% =empl.Phone1%>"/>
			</td>
			<td>
				移动电话：<br />
				<input type="text" id="mobile" name="mobile" value="<%=empl.Mobile%>" />
			</td>
		</tr>
		<tr>            
			<td>
				电子邮件：<br />
				<input type="text" id="email" name="email" value="<%=empl.Email%>" />
			</td>
			<td>
				MSN或QQ：<br />
				<input type="text" id="pager" name="pager" value="<%=empl.Messenger%>" />
			</td><td>
				
			</td>
		</tr>
	</table>
    </div>
    <div class="editFormSubbar">公司信息</div>
    <div>
     <table id="Table1"  border="0" cellpadding="3">
		<tr>
			<td>
				<font color="red">*</font>部门：<br />
				<input type="text" id="deptName" name="deptName" value="<% =curDeptName%>" readonly /><input type="hidden" id="deptID" name="deptID" value="<% =curDeptID%>" /><input type="button" value="..." onclick="selectDept()" />
			</td>
			<td>
				职位：<br />
				<select id="positionID" name="positionID"><%WritePosition(); %></select>
			</td>
		</tr></table></div>
    <div class="editFormBottom"><input type="button" value="  保存  " onclick="doSave('n')" />&nbsp;<input type="button" value="保存并继续" onclick="doSave('y')" />&nbsp;<input type="button" value=" 取消 " onclick="self.close();" /><input type="hidden" id="hidIsContinue" name="hidIsContinue" value="" /> <span id="tipSpan"><%=tip %></span></div>
    
    </form>

</body>
</html>
